package co.edu.usbcali.ai.ga.samples.hello;

import co.edu.usbcali.ai.ga.ICromosom;
import co.edu.usbcali.ai.ga.Breed;
import co.edu.usbcali.ai.ga.impl.CharCromosomType;
import co.edu.usbcali.ai.ga.impl.SimpleCromosom;

public class HelloBreed extends Breed {

	public HelloBreed(int size) {
		super("Hello World");
		setCromosomType(new CharCromosomType(size));
		setCromosomClass(SimpleCromosom.class);
	}

	@Override
	public float eval(ICromosom cromosom){
		float res=0;
		String goal="Hello World";
		for(int con=0;con<cromosom.size();con++){
			if(goal.charAt(con)==((Character)(cromosom.get(con).getValue()))){
				res++;
			}
		}
		return res;		
	}

	@Override
	public String getFenotype(ICromosom cromosom) {
		String chain="";
		for(int con=0;con<cromosom.size();con++){
			chain+=cromosom.get(con).toString();
		}
		return chain;
	}
	
	
}
